<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Jialeo\LaravelSchemaExtend\Schema;

class CreateCustomerSendCouponLogsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('customer_send_coupon_logs', function (Blueprint $table) {
            $table->id();
            $table->unsignedBigInteger('userId')->default(0)->comment('用户id');
            $table->unsignedInteger('activityId')->default(0)->comment('活动id');
            $table->unsignedTinyInteger('activityType')->default(1)->comment('活动类型 1：新用户注册');
            $table->unsignedInteger('createdAt')->default(0)->comment('创建时间');
            $table->unsignedInteger('updatedAt')->default(0)->comment('更新时间');
            $table->tinyInteger("isDeleted")->default(0)->comment("是否删除,0:未删除,1:已删除");
            $table->index(['userId', 'activityType'], 'idx_user_activityType_id');
            $table->collation = 'utf8mb4_general_ci';
            $table->comment   = '用户领券记录表';
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('customer_send_coupon_logs');
    }
}
